var index = (function (window, $, document, undefined) {
    var basePath = $('#basePath').val();

    function typeNavClick() {
        $(".foodNavContainer").on("click", "a", function (event) {
            event.preventDefault();
            var $this = $(this), typeId = $this.attr("commodityTypeId"),
                statusId = $(".onShelfContainer a[class*='topNavSelected']").attr("commodityStatusId");
            window.location.href = basePath + "commodity/retrieveTargetCommodities.do?commodityTypeId=" + typeId + "&commodityStatusId=" + statusId;
            return false;
        });
    }

    function statusNavClick() {
        $(".onShelfContainer").on("click", "a[commodityStatusId]", function (event) {
            event.preventDefault();
            var $this = $(this), statusId = $this.attr("commodityStatusId"),
                typeId = $(".foodNavContainer a[class*='leftNavSelected']").attr("commodityTypeId");
            window.location.href = basePath + "commodity/retrieveTargetCommodities.do?commodityTypeId=" + typeId + "&commodityStatusId=" + statusId;
            return false;
        });
    }

    return {
        init: function () {
            typeNavClick();
            statusNavClick();
        }
    };
})(window, jQuery, document);